#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int a[N], b[N], c[N], n, m, p[N], ans;
int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) b[i] = a[i];
    ans = n;
    sort(b + 1, b + n + 1);
    m = unique(b + 1, b + n + 1) - b - 1;
    for (int i = 1; i <= n; i++)
    {
        c[i] = lower_bound(b + 1, b + m + 1, a[i]) - b;
        if (p[c[i]] == 0) p[c[i]] = i;
    }
    for (int i = 1, j = p[2]; i <= n && j <= n; i++, j++)
    {
        if (p[c[i]] == p[c[n]]) break;
        if (c[i] == c[j]) j = p[c[i] + 1];
        if (i <= n && j <= n) ans--;
    }
    cout << ans << "\n";
    return 0;
}
